//
//  BookTableViewCell.m
//  MyReader
//
//  Created by hh on 15/12/7.
//  Copyright © 2015年 hh. All rights reserved.
//

#import "BookTableViewCell.h"

@implementation BookTableViewCell

- (id)initWithImgs:(NSArray *)imgs
{
    self = [super init];
    NSAssert(imgs.count < 4, @"cell内的图片不能多于3个！");
    NSMutableArray *arr = [NSMutableArray array];
    for (UIImage *img in imgs) {
        UIImageView *iv = [[UIImageView alloc] initWithImage:img];
        [self addSubview:iv];
        [arr addObject:iv];
    }
    self.imgs = arr;
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat edge = 15;
    CGFloat imgWidth = (self.frame.size.width - edge*4)/3.0;
    int i = 0;
    for (UIImageView *iv in self.imgs) {
        iv.frame = CGRectMake(edge + i*(imgWidth + edge), 8, imgWidth, 139 - 8*2 - 8);
        i++;
    }
}

@end
